package magicbattle.game.character.effect;

import magicbattle.game.Player;

public abstract class OverTimeEffect extends Effect {

	// per 10 ms
	protected int duration;
	protected int interval;
	
	protected String effectName;

	public void doTick(Player currentPlayer) {
		
		this.duration--;
		
		// end of effect?
		if(this.duration == 0) {
			this.atEnd(currentPlayer);
		}
		
		// process interval effect
		if((this.interval > 0) && ((this.duration % this.interval) == 0)) {
			this.doInterval(currentPlayer);
		}				
	}

	public abstract void doInterval(Player currentPlayer);
	
	public abstract void atEnd(Player currentPlayer);
}
